-module(test_encode).
-compile(export_all).

-include_lib("eunit/include/eunit.hrl").


cp932_to_utf8_test() ->
    ?assertMatch([16#E3, 16#81, 16#82], quek_encode:to_utf8(quek_cp932, [16#82, 16#A0])),
    ?assertMatch([16#82, 16#A0], quek_encode:from_utf8(quek_cp932, [227,129,130])),
    ?assertMatch([16#E3, 16#81, 16#82,
                  16#E3, 16#81, 16#84,
                  16#E3, 16#81, 16#86], 
                 quek_encode:to_utf8(quek_cp932, [16#82, 16#A0,
                                        16#82, 16#A2,
                                        16#82, 16#A4])),
    ?assertMatch([16#82, 16#A0,
                  16#82, 16#A2,
                  16#82, 16#A4],
                 quek_encode:from_utf8(quek_cp932, [16#E3, 16#81, 16#82,
                                          16#E3, 16#81, 16#84,
                                          16#E3, 16#81, 16#86])),
    ?assertMatch("$B!A(B", quek_encode:from_utf8(quek_cp932, quek_encode:to_utf8(quek_cp932, "$B!A(B"))).
